#include "wxsstaticboxsizer.h"

namespace {
  wxsRegisterItem<wxsStaticBoxSizer> Reg( _T( "StaticBoxSizer" ), _T( "StaticBoxSizer" ), wxsTSizer, _T( "布局" ), 20 );
}

wxsStaticBoxSizer::wxsStaticBoxSizer( wxsItemResData* Data ):
  wxsSizer( Data, &Reg.Info ), Orient( wxHORIZONTAL ), Label( _T( "Label" ) ) {
}

wxSizer* wxsStaticBoxSizer::OnBuildSizerPreview( wxWindow* Parent ) {
  return new wxStaticBoxSizer( Orient, Parent, Label );
}

void wxsStaticBoxSizer::OnBuildSizerCreatingCode() {
  switch( GetLanguage() ) {
  case wxsCPP: {
    AddHeader( _T( "<wx/sizer.h>" ), GetInfo().ClassName, hfInPCH );
    Codef( _T( "%C(%s, %W, %t);\n" ), ( Orient != wxHORIZONTAL ) ? _T( "wxVERTICAL" ) : _T( "wxHORIZONTAL" ), Label.wx_str() );
    return;
  }
  case wxsUnknownLanguage:
  default: {
    wxsCodeMarks::Unknown( _T( "wxsStaticBoxSizer::OnBuildSizerCreatingCode" ), GetLanguage() );
  }
  }
}

void wxsStaticBoxSizer::OnEnumSizerProperties( M_Code_unused long Flags ) {
  static const long    OrientValues[] = { wxHORIZONTAL, wxVERTICAL, 0 };
  static const wxChar* OrientNames[]  = { _T( "wxHORIZONTAL" ), _T( "wxVERTICAL" ), 0 };
  WXS_SHORT_STRING( wxsStaticBoxSizer, Label, _T( "Label" ), _T( "label" ), _T( "" ), false );
  WXS_ENUM( wxsStaticBoxSizer, Orient, _T( "Orientation" ), _T( "orient" ), OrientValues, OrientNames, wxHORIZONTAL );
}
